package com.you.concurrent.future;

import com.sun.deploy.security.MSCryptoDSASignature;

import java.util.concurrent.*;

public class FutureTaskDemo {

    public static void main(String[] args) throws ExecutionException, InterruptedException, TimeoutException {
        FutureTask futureTask = new FutureTask(new Callable<String>() {
            @Override
            public String call() throws Exception {
                System.out.println("-------start.......");
                Thread.sleep(1000L);
                return "test future task!";
            }
        });
        new Thread(futureTask).start();
        System.out.println(futureTask.get(100, TimeUnit.SECONDS));

    }
}
